﻿Public Class Frm_Fax_Bure

    Private Sub Frm_Fax_Bure_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        Frm_Clients.Enabled = True
        Frm_Adver.Enabled = True
        Frm_Avoc_Adv.Enabled = True
        Frm_Avoc_Clien.Enabled = True
        Frm_Avoc_mokhabara.Enabled = True
        Frm_dalil.Enabled = True

        Try
            Partager.list_fax.Clear()
            For Each a As ListViewItem In List_tele.Items
                Dim ph As New Phone(1, a.Text, "Fax")
                Partager.list_fax.Add(ph)
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        Frm_Avoc_Bure.List_tous.Focus()
    End Sub


    Private Sub btn_ajout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_ajout.Click
        If (txt_tele.Text <> "") Then
            Dim Line As ListViewItem = New ListViewItem(New String() {txt_tele.Text})
            List_tele.Items.Add(Line)
            txt_tele.Clear()
            txt_tele.Select()
        End If
    End Sub

    Private Sub txt_tele_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_tele.KeyPress
        Dim allowedChars As String = "1234567890"
        If e.KeyChar = ChrW(8) Then
            e.Handled = False
        ElseIf allowedChars.IndexOf(e.KeyChar) = -1 Then
            ' Invalid Character
            e.Handled = True
        End If
    End Sub

    Private Sub btn_supp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_supp.Click
        For Each ligne As ListViewItem In List_tele.SelectedItems
            ligne.Remove()
        Next

    End Sub

    Private Sub Frm_Fax_Bure_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        For Each a As Object In Partager.list_fax
            Dim str As Phone = CType(a, Phone)
            Dim Line As ListViewItem = New ListViewItem(New String() {str.Num})
            List_tele.Items.Add(Line)
        Next
    End Sub
End Class